package com.itholmes.tomcat;

import com.itholmes.ServletConfig.ServletConfig;

public abstract class MyServlet {
	
	//通过config来存储servletconfig的域数据，从tomcat一开始启动的时候就必须要加载除config这个对象。
	private transient ServletConfig config;
	
	public ServletConfig getConfig() {
		return config;
	}

	public void setConfig(ServletConfig config) {
		this.config = config;
	}

	public void service(MyRequest req ,MyResponse resp) {
		if((req.getRequest_method()).equalsIgnoreCase("get")) {
			doGet(req,resp);
		}else if((req.getRequest_method()).equalsIgnoreCase("post")) {
			doPost(req, resp);
		}
	}
	
	public void doGet(MyRequest req ,MyResponse resp) {
		
	}
	
	public  void doPost(MyRequest req ,MyResponse resp) {
		
	}
	
	//导入ServletConfig对象
	public ServletConfig getServletConfig() {
        return config;
    }
	
}
